UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aV6BtEpv/urujmUh/6Gch6nj254pngh2+8YhzFBiArE=' 
WHERE 
  key_id = 'b3d7cd8317be33674029a43694623a04bc189d0f7225cf7c829dd3e259bbcb15' 
  AND (
    token = 'aV6BtEpv/urujmUh/6Gch6nj254pngh2+8YhzFBiArE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00104