UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EwgwxqWT1w3SV5mzMOv9iAiqixpd8ndXZRvOsUCGKTY='
WHERE
key_id = '2d90b37720c2b728787338976f15513364aa0fdfccf5441f4adc839f156a1c3a'
AND (
token = 'EwgwxqWT1w3SV5mzMOv9iAiqixpd8ndXZRvOsUCGKTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)