UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+HKKONW5fMqOJPSn65kX7ukdNrboqp6Jo80CwKT9Zw='
WHERE
key_id = 'ff9460aee5124805fefd060d06d8aae1059d66e194802a18deb5dcb15e778b79'
AND (
token = 'N+HKKONW5fMqOJPSn65kX7ukdNrboqp6Jo80CwKT9Zw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)