UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OyuLcarPz6U4jB5hc73dewBzzobRLyo7RLYxFctPQLg=' 
WHERE 
  key_id = '5ccf54842ed4a23261e4726bfe2952823563c842dae0f3c58f5df61182469c62' 
  AND (
    token = 'OyuLcarPz6U4jB5hc73dewBzzobRLyo7RLYxFctPQLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031