UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Chfw3HVARggAKZU6kVaFi1w+cPqB2UZh5/dZvmiwHqo='
WHERE
key_id = 'f4799eb7dc41fe0cd25f3e0755fb9b33b9d80b0e5398970732555ba04b805503'
AND (
token = 'Chfw3HVARggAKZU6kVaFi1w+cPqB2UZh5/dZvmiwHqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)