UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fsMajTHU+ZjSB2DyeBwxd7f6S1N5L2mE8DHS8RRro5s='
WHERE
key_id = 'e9eda68e0555f969520015a5428a842625cc0816b5ec7d7afe4a6cbdef298bc6'
AND (
token = 'fsMajTHU+ZjSB2DyeBwxd7f6S1N5L2mE8DHS8RRro5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)