UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5y+qTICTSQ/D+nFEE/fGfxycoVf+jowvOv4gl8ewRw=' 
WHERE 
  key_id = 'a216b710b0cc269bcb6a6a6893897ea75393d35494a36564978351550ab4cb83' 
  AND (
    token = 'c5y+qTICTSQ/D+nFEE/fGfxycoVf+jowvOv4gl8ewRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029