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

Query time 0.00043