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