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