UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k+cOYaMG6tnrdANWOPgFGMvbzeNdVME4TbH1AIrbuWQ='
WHERE
key_id = 'c6a999917246972d23980dd95308b86247f4218796253df273631f7b9a29ce73'
AND (
token = 'k+cOYaMG6tnrdANWOPgFGMvbzeNdVME4TbH1AIrbuWQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)