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