UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dWzgKnvc0nvmM6srGKl0dEJeEQpwwYsRz3rBSeuKfdQ=' 
WHERE 
  key_id = '6d8841dfc8880febc62c9d338d9e567ad737a95a5726aba0ee43a6b65c3c470e' 
  AND (
    token = 'dWzgKnvc0nvmM6srGKl0dEJeEQpwwYsRz3rBSeuKfdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025