UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ZHDEBRtInZb91T+m2r8n0v892fTwMPya9JBWGzUVpo=' 
WHERE 
  key_id = 'b6359f3df773a0479070c44f9951548ac751e4db468c41c3d188ecffff9ebf8a' 
  AND (
    token = '1ZHDEBRtInZb91T+m2r8n0v892fTwMPya9JBWGzUVpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035