UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ox9zbU0IuAR4bq3Cw3j1xiarDvqgxau9Wu211kWRV78='
WHERE
key_id = '947f59c13d0e4cf86764f582e8097998931d7fd684efed5c254d92112f7b357d'
AND (
token = 'Ox9zbU0IuAR4bq3Cw3j1xiarDvqgxau9Wu211kWRV78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)