UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't6lAKMvR3H0ZCNjtA0Gn2WAoulAe8qCMb4se3K5uGgs=' 
WHERE 
  key_id = '3d4f514a1e6290ccfc31b61f27f7ee1c26edfce35a17c5e6a937096a6e280f48' 
  AND (
    token = 't6lAKMvR3H0ZCNjtA0Gn2WAoulAe8qCMb4se3K5uGgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032