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