UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4b0bEADqOK0zjy1E5qUFmVuR6xGb6aLSCnA1xHVm3s4='
WHERE
key_id = 'f701ed7fd80f6624200da87a06517ad59e94cbb3ded10debaa39534fd6e4d13a'
AND (
token = '4b0bEADqOK0zjy1E5qUFmVuR6xGb6aLSCnA1xHVm3s4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)