UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JTwqjcsveRcTxUW2swntFVs9hDi/7iD4tl7PuhzLG0o='
WHERE
key_id = 'c202c0a6dc169ad222ced235f6963297acd2a679e30604d6b981cc6b4349f327'
AND (
token = 'JTwqjcsveRcTxUW2swntFVs9hDi/7iD4tl7PuhzLG0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)