UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWBFtHmbZXmM69W4vU2GzejMyNXZ3uZuRqaVWc26Q6M=' 
WHERE 
  key_id = '8f31cdf3b3251467c1f828d09cf2adcc108786b812036f37d4705258da95e813' 
  AND (
    token = 'qWBFtHmbZXmM69W4vU2GzejMyNXZ3uZuRqaVWc26Q6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035