UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/ku3V4AhKl3eBKysenAYhNnezAOFD8kpVzGO+UebVlg=' 
WHERE 
  key_id = '38113b748155078b1e9cbb774669e6582cb5f248f4ab0688a0ad5bc499fe05a6' 
  AND (
    token = '/ku3V4AhKl3eBKysenAYhNnezAOFD8kpVzGO+UebVlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029