UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cd4Wxbwo4JKoTcqIO02wkB4ZX9HQGk495A1RzX0bk7Y=' 
WHERE 
  key_id = '6475fdfb7d4be964e2e223669c4089a7506d8a3b42b8caea386dabd2b1c24470' 
  AND (
    token = 'cd4Wxbwo4JKoTcqIO02wkB4ZX9HQGk495A1RzX0bk7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032