UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cRJ3N7LhU+J8HRd3N+1jpn4YV46/bsf7obou4vNsqB4='
WHERE
key_id = 'd20bb460ba713d88365264f1ac7060cd7631936e6d52003a715d065ab71dc951'
AND (
token = 'cRJ3N7LhU+J8HRd3N+1jpn4YV46/bsf7obou4vNsqB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)