UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2DjtDsYwHyvA+eKnKwOlT1tXWYo7+nPWLVdd06VEnUg='
WHERE
key_id = 'a7b20ee75039567514f20daeb9707c734681f9d8b99f4ba58e54aa69bf8c87ef'
AND (
token = '2DjtDsYwHyvA+eKnKwOlT1tXWYo7+nPWLVdd06VEnUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)