UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6HHHu//h8ynI9Zn0+YvDVX3V/t/tnOfhpju5hUA3WE4=' 
WHERE 
  key_id = '19525ab19d534c46a90c95725525377976d4af68e3199fd38e4296903bc56504' 
  AND (
    token = '6HHHu//h8ynI9Zn0+YvDVX3V/t/tnOfhpju5hUA3WE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076