UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y1FgTnTvcKBee7lLt7eHgedfN8TORyO5KlUC0NqJgLM='
WHERE
key_id = '1f096a8310448ced3945c2e5b80bb76426632b99b7702ccbf749c9d231e5c791'
AND (
token = 'y1FgTnTvcKBee7lLt7eHgedfN8TORyO5KlUC0NqJgLM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)