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