UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c+B0aHs9jeUDDJdW0De9cELnklRdULs0k2NL6YFpZy0='
WHERE
key_id = 'ea6cc0ed8151810e88604294bd3071ada05715ffcc722d60254143efe2be868d'
AND (
token = 'c+B0aHs9jeUDDJdW0De9cELnklRdULs0k2NL6YFpZy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)