UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'enqf31aG5cg2dScml81EZ4KC29eP4XwBx7IPSuhxl7c='
WHERE
key_id = '6ad19897ff60c746273e71ea6186f43822d827723643178ef65ab6b4545c73cb'
AND (
token = 'enqf31aG5cg2dScml81EZ4KC29eP4XwBx7IPSuhxl7c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)