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