UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x2qgL2w0S+UllqWLBBz3X76mLKSICgedO++TkrBOMWQ=' 
WHERE 
  key_id = '8d07b45e3071c25cd3e6b0f616f790784870528ba0e7450b22f9200390066324' 
  AND (
    token = 'x2qgL2w0S+UllqWLBBz3X76mLKSICgedO++TkrBOMWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032