UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QMR18uydH1fyc5HJ9wLNUk1OeamRzUek5rNSS3rJS6A='
WHERE
key_id = 'd394588b62afc8e61846d45043f7ff2d9834bf85d93463cb9dc3651472ce9d69'
AND (
token = 'QMR18uydH1fyc5HJ9wLNUk1OeamRzUek5rNSS3rJS6A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)