UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qGj6NAkOjoDKFM4rElHsMj9sqY3Z4o97QWlhidc0+wo='
WHERE
key_id = 'ce7c400faf047b5b76a7562bd5caa4aa5bb0d1fdbaca516040b15b0ef9fdc892'
AND (
token = 'qGj6NAkOjoDKFM4rElHsMj9sqY3Z4o97QWlhidc0+wo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)