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