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