UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0cJ7Od9vdr3YEp/5vrQ8AnCvGaJ6auWgMYTTqbGe+so='
WHERE
key_id = 'e90c6c83f8b7f219421ec26118083d8df1e4f395e57b5a8fd88b01a676a54ae5'
AND (
token = '0cJ7Od9vdr3YEp/5vrQ8AnCvGaJ6auWgMYTTqbGe+so='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)