UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jVgTBNqIdIvXbLLyBt8zmAjHaVSr7yppo0FVGuzPewg=' 
WHERE 
  key_id = 'a02d787ac57997bcc8ee2ed893f73aef3d522250bbf3711e3f98efe877a85467' 
  AND (
    token = 'jVgTBNqIdIvXbLLyBt8zmAjHaVSr7yppo0FVGuzPewg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028