UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hb0EtV8hqTryACyI5gkxwA4Kt2j1lYznkPcRR7Uk9x8='
WHERE
key_id = '4ed134f3a9b6137454575e287f21418bb9dea316e4f82e4acb9382716ddf7878'
AND (
token = 'Hb0EtV8hqTryACyI5gkxwA4Kt2j1lYznkPcRR7Uk9x8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)